package com.water.service.impl;

import com.water.dao.BeOrderuserDao;
import com.water.entity.BeOrderuser;
import com.water.service.BeOrderuserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (BeOrderuser)表服务实现类
 *
 * @author makejava
 * @since 2020-12-14 19:18:48
 */
@Service("beOrderuserService")
public class BeOrderuserServiceImpl implements BeOrderuserService {
    @Resource
    private BeOrderuserDao beOrderuserDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BeOrderuser queryById(Integer id) {
        return this.beOrderuserDao.queryById(id);
    }

    @Override
    public List<BeOrderuser> queryAll(BeOrderuser beOrderuser) {
        return this.beOrderuserDao.queryAll(beOrderuser);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<BeOrderuser> queryAllByLimit(int offset, int limit) {
        return this.beOrderuserDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param beOrderuser 实例对象
     * @return 实例对象
     */
    @Override
    public BeOrderuser insert(BeOrderuser beOrderuser) {
        this.beOrderuserDao.insert(beOrderuser);
        return beOrderuser;
    }

    @Override
    public List<BeOrderuser> insertBatch(List<BeOrderuser> entities) {
        this.beOrderuserDao.insertBatch(entities);
        return entities;
    }

    /**
     * 修改数据
     *
     * @param beOrderuser 实例对象
     * @return 实例对象
     */
    @Override
    public BeOrderuser update(BeOrderuser beOrderuser) {
        this.beOrderuserDao.update(beOrderuser);
        return this.queryById(beOrderuser.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.beOrderuserDao.deleteById(id) > 0;
    }
}